﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ExtAspNet;

namespace HY.WEB.OA
{
    public partial class work_add : PageBase
    {
      
         public string us ;
        protected void Page_Load(object sender, EventArgs e)
        {  
            us=Session["ID"].ToString();
            if (!IsPostBack)
            {
                RBG1.Visible =false;
                if (!String.IsNullOrEmpty(Request["stype"]))
                {

                     hidstype.Text = Request["stype"].Trim();
                     if (hidstype.Text == "WK") RBG1.Visible = true;

                }
            }

        
        }

      
  
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string title = txttitel.Text;
            string fileName = fileup.ShortFileName;
            string subtype = RBG1.SelectedValue;

            string person = Session["ID"].ToString();
            string day = "0"; // txtday.Text;
          //  string memo = HttpUtility.HtmlEncode(FCKeditor1.Value);
            string memo = HttpUtility.HtmlEncode(FCKeditor1.Value);
            string path = "";

            if (fileName.Length >0)
            {
                fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
                fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;
                path = "~/file/oa/" + fileName;
                if (fileup.HasFile)
                    fileup.SaveAs(Server.MapPath(path));

            }

            BLL.oa.ad.insert(title, person, day, memo, path, hidstype.Text,subtype);


            Alert.Show("添加完成 ");
            PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(hidstype.Text) + ActiveWindow.GetHidePostBackReference());
        }

       
    }
}